package cn.gson.crm.controller.follow;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.gson.crm.controller.BaseServlet;
import cn.gson.crm.model.dao.FollowDao;
import cn.gson.crm.model.entity.Employee;
import cn.gson.crm.vo.FollowVo;

/**
 * Servlet implementation class FollowSearchAll
 */
@WebServlet("/search/all")
public class FollowSearchAll extends BaseServlet {
	private static final long serialVersionUID = 1L;
	public FollowDao fd = new FollowDao();

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void get(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String id = request.getParameter("id");
		List<FollowVo> listFo = fd.getAllFollowInfoByCustomerId(Integer.parseInt(id));
		Long times = fd.getTotalTimesByCustId(Integer.parseInt(id));
		request.setAttribute("times", times);
		request.setAttribute("listFo", listFo);
		Employee e = (Employee) request.getSession().getAttribute("emp");
		request.setAttribute("emp", e);
		String name = request.getParameter("name");
		request.setAttribute("name", name);
		forward("follow/follow_search_all.jsp");
	}

}
